/**
 * 
 */
package org.xlab.baseframework.test.service;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
import org.xlab.baseframework.service.api.ISystemMailService;
import org.xlab.baseframework.test.base.BaseTester;

/**
 * @author makubex
 * 
 */
@RunWith(BaseTester.class)
@ContextConfiguration("classpath:org/xlab/baseframework/conf/module/*/baseframework-*.xml")
public class SystemMailSenderTestCase {

	private static final Logger log = Logger
			.getLogger(SystemMailSenderTestCase.class);

	@Autowired
	@Qualifier("bpf_systemMailService")
	private ISystemMailService systemMailService;

	@Test
	public void skip() {
		log.debug("Skip this test." + systemMailService);
	}

	@Test
	public void testSendMail() {
		log.debug("Now, testing send mail to makubexnet@gmail.com...");
		Map<String, Object> model = new HashMap<String, Object>();
		model.put("userName", "MaKuBEX");
		model.put("emailAddress", "makubexnet@gmail.com");
		model.put("testingTime", new Date());
		systemMailService.sendMail(model, "Welcome",
				"org/xlab/baseframework/template/TEMPLATE_MAIL_TEST.vm",
				new String[] { "makubexnet@gmail.com" }, null, null, null);
	}
}
